#include "../interface/IBackground.h"
#include <Windows.h>

namespace swui
{	
	bool IBackground::_combine_child_rgn(HRGN hRgn) {
		if(isBackgroundEnabled() && isBackgroundCombineRgnEnabled())
		{
			ctlRect rect = getAbsoluteRect().deflate(ctlPoint(1, 1));
			HRGN rgn = CreateRectRgn(rect.getLeft(), rect.getTop(), rect.getRight(), rect.getBottom());
			CombineRgn(hRgn, hRgn, rgn, RGN_AND);
			DeleteObject(rgn);
			return true;
		}
		return false;
	}
}